/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Common;

import Forms.MainForm;
import NetworkRequests.*;

/**
 *
 * @author Hmong
 */
public class TestNetwork implements Runnable {

    public void Start(){
        Thread thread = new Thread(this);
        try {
            thread.start();
        } catch (Exception e) {
        }
    }

    public void StartEx(){
        NetworkTestRequest req = new CMNetSocketRequest();
        req.Start();

        req = new CMNetHttpRequest();
        req.Start();

        req = new CMWapHttpRequest();
        req.Start();
    }
    
    public void run() {
        NetworkTestRequest req = new CMNetSocketRequest();
        req.run();

        if (req.IsCommunicationSuccess()){
            MainForm.GetInstance().ConnectTypeTestCompleted();
            return;
        }
        
        req = new CMNetHttpRequest();
        req.run();

        if (req.IsCommunicationSuccess()){
            MainForm.GetInstance().ConnectTypeTestCompleted();
            return;
        }

        req = new CMWapHttpRequest();
        req.run();

        MainForm.GetInstance().ConnectTypeTestCompleted();
    }

}
